package bktech.soict.hust.bknote.sendsms;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.SmsManager;
import bktech.soict.hust.bknote.util.MyToast;

/**
 * Broadcast listen when the SMS have been sent
 * 
 * @author DIZAII
 * 
 */
public class BroadcastSendSms extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		switch (getResultCode()) {
		case Activity.RESULT_OK:
			MyToast.show(context, "SMS sent");
			break;
		case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
			MyToast.show(context, "Generic failure");
			break;
		case SmsManager.RESULT_ERROR_NO_SERVICE:
			MyToast.show(context, "No service");
			break;
		case SmsManager.RESULT_ERROR_NULL_PDU:
			MyToast.show(context, "Null PDU");
			break;
		case SmsManager.RESULT_ERROR_RADIO_OFF:
			MyToast.show(context, "Radio off");
			break;
		default:
			break;
		}
	}
}
